-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed "Title jumps to the next line, out of the toolbar #508" #509
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
I signed it! |
CLAs look good, thanks! |
Codecov Report
@@ Coverage Diff @@
## master #509 +/- ##
=======================================
Coverage 99.02% 99.02%
=======================================
Files 45 45
Lines 2050 2050
Branches 251 251
=======================================
Hits 2030 2030
Misses 20 20 Continue to review full report at Codecov.
|
Hey @touficbatache ,
I suggested the solution we would like to have for this problem as comment. If you could modify your PR and we would willing to help you merge it. Thanks for filing the PR to solve the issue. |
@@ -68,6 +68,7 @@ $mdc-toolbar-mobile-breakpoint: 599px; | |||
&--align-end { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of modifying --align-end
directly, we would like to have a mdc-toolbar--section-shrink-to-fit
modifier that set flex: none
.
In your specific use case, you can do something like:
<section class="mdc-toolbar__section mdc-toolbar__section--align-start">
<span class="mdc-toolbar__title">This is a very long title</span>
</section>
<section class="mdc-toolbar__section mdc-toolbar__section--align-end mdc-toolbar--section-shrink-to-fit">
...
</section>
@@ -68,6 +68,7 @@ $mdc-toolbar-mobile-breakpoint: 599px; | |||
&--align-end { | |||
justify-content: flex-end; | |||
order: 1; | |||
flex: 0; | |||
} | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to accommodate a super long title, we also need to add:
.mdc-toolbar__section {
overflow: hidden;
}
.mdc-toolbar__title {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
Here is a pen for demonstrating the case.
@yeelan0319 I made the necessary changes but the problem is that TravisCI is failing. |
@touficbatache It seems like this what TravisCI is complaining happened in
|
Do you know what is causing that?
|
You need a empty line between |
Oh. A simple problem... I'll fix that... Thankss
|
Yep! Exactly what TravisCI complained about in its log :) |
Looks good. I will merge it once check passed. |
Ok thank you. :)
|
Since we are adding a new modifier class, we should also documented the behavior in following places:
I think we could change it to something like
It should help if we add a paragraph of sample code there.
I think that should be it! Thanks @touficbatache for your help! |
No problem. Happy to help :) Yes, this should be the last commit. Thanks |
packages/mdc-toolbar/README.md
Outdated
@@ -139,3 +139,4 @@ The provided modifiers are: | |||
| `mdc-toolbar--fixed` | Make toolbar fixed to top of screen. | | |||
| `mdc-toolbar__section--align-start` | Makes section aligns to the start. | | |||
| `mdc-toolbar__section--align-end` | Makes section aligns to the end. | | |||
| `mdc-toolbar__section--shrink-to-fit`| Makes section take more space. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are setting flex: none
, it is actually the opposite.
Makes section takes the width of its content.
packages/mdc-toolbar/README.md
Outdated
@@ -96,7 +96,7 @@ of the toolbar (respectively). | |||
``` | |||
|
|||
Toolbar sections are laid out using flexbox. Each section will take up an equal | |||
amount of space within the toolbar. | |||
amount of space within the toolbar by default. But you can accommodate very long section (very long title) by adding `mdc-toolbar__section--shrink-to-fit` to the rest of the section |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
the rest of the section >> other sections.
-
Could you also add the following sample code
<div class="mdc-toolbar>
<div class="mdc-toolbar__row">
<section class="mdc-toolbar__section mdc-toolbar__section--align-start">
<span class="mdc-toolbar__title">This is a super super super super long title</span>
</section>
<section class="mdc-toolbar__section mdc-toolbar__section--align-end mdc-toolbar__section--shrink-to-fit">
<a class="material-icons search align-icons" aria-label="Search" alt="Search">search</a>
</section>
</div>
</div>
Hey,
I tried to fix the toolbar problem with adding a
flex: 0;
style to the.mdc-toolbar__section--align-end
class as mentioned in the issue #508.EDIT
I added a class
mdc-toolbar__section--shrink-to-fit
that fixes the problem as well as some essential css code. Thanks to @yeelan0319.